#set(title="会员中心 - "+param("AUTH_ERP_NAME"))
#@LayuiLayout()
#define css()
	<link rel="stylesheet" href="#(res_path)/layui/extend/contabs.css">
#end
#define cssStyle()
<style>
.left-nav .layui-nav-tree .layui-nav-item a {line-height: 35px;height: 35px;font-size: 13px}
.left-nav .layui-nav-item .layui-nav-more {top: 15px}
.left-nav .layui-nav-itemed .layui-nav-more {top: 9px}

</style>
#end
#define content()
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">#(param("AUTH_ERP_NAME"))</div>
    <ul class="layui-nav layui-layout-left top-nav">
			#for(item1:menu)
				#if(!item1.value.type||item1.value.type=="menu")
				<li class="layui-nav-item #if(for.first)layui-this#end" >
	       	<a href="javascript:;" data-rights="#(item1.value.rights)">#(item1.value.name)</a>
	     	</li>
	     	#end
			#end
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">#(AUTHSESSION.name)</a>
        <dl class="layui-nav-child">
          <dd><a href="javascript:;" onclick="layer.open({area:['400px','300px'],content: 'editPassword',type: 2,title: '修改密码'});" id="editPassword">修改密码</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="#(res_path)#(PRE_PATH)/auth/logout">注销</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
		<div class="layui-side-scroll left-nav"></div>
  </div>
  
  <div class="layui-body">
    <div class="row content-tabs">
    	<button class="roll-nav roll-left J_tabLeft"><i class="layui-icon">&#xe603;</i></button>
      <nav class="page-tabs J_menuTabs">
      	<div class="page-tabs-content">
      		<a href="javascript:;" class="active J_menuTab" data-id="auth/index">首页</a>
      	</div>
      </nav>
      <button class="roll-nav roll-right J_tabRight"><i class="layui-icon">&#xe602;</i></button>
    </div>
    <div class="row J_mainContent" id="content-main">
      <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="auth/index" frameborder="0" data-id="auth/index" seamless></iframe>
    </div>
  </div>
  <div class="layui-footer">
    #(param("AUTH_ERP_NAME"))
  </div>
</div>
#end
#define jsFunction()
<script id="leftNavTpl" type="text/html">
<ul class="layui-nav layui-nav-tree content-menus">
	{{# layui.each(d.children, function(index, item){ }}
	<li class="layui-nav-item {{# var jfinal=3.2;if(index === 0){ }}layui-nav-itemed{{#  } }} ">
		<a class="javascript:;" href="javascript:;">{{ item.name }}</a>
		<dl class="layui-nav-child">
			{{# layui.each(item.children, function(index2, item2){ }}
			<dd><a class="J_menuItem" href="{{d.path}}#(PRE_PATH){{item2.url}}" data-index="{{index}}-{{index2}}">{{item2.name}}</a></dd>
			{{# }); }}
		</dl>
	</li>
	{{# }); }}
</ul>
</script>
<script>
	layui.config({
	  base: "#(res_path)/layui/extend/"
	});
	layui.use(['layer','laytpl','element','contabs'],function(){
		var $ = layui.jquery;
		var rights = $.parseJSON('[#for(item1:menu)#(item1.value)#if(!for.last),#end#end]');
	  var layer = layui.layer;
	  var laytpl = layui.laytpl;
	  var element = layui.element;
	  var contabs = layui.contabs;
	  contabs.init();
		$(".top-nav a").click(function(){
			var thisRights = $(this).data("rights");
			$.each(rights,function(index,item){
				if(item.rights==thisRights){
					laytpl($("#leftNavTpl").html()).render(item, function(html){
						  $(".left-nav").html(html);
						  element.init();
						  contabs.start();
					});
				}
			});
		});
		$(".top-nav a:first").trigger("click");
	});
 	var messageTip = new WebSocket("ws://"+window.location.host+"#(res_path)/websocket/MEMBER/message.ws");
 	messageTip.onerror=function(event){
 		showNotification("#(param("MEMBER_NAME"))最新提醒","消息服务已断开，30秒后重新连接或直接刷新网页",20000);
 		setTimeout(function(){
 			messageTip = new WebSocket("ws://"+window.location.host+"#(res_path)/websocket/MEMBER/message.ws");
 		},30000);
 	};
  messageTip.onopen=function(event){
	  messageTip.send("cookie:"+document.cookie);
  };
  messageTip.onmessage=function(event){
	  showNotification("#(param("MEMBER_NAME"))最新提醒",event.data,20000);
  };
</script> 
#end